//
//  ChatMessage.swift
//  WeChatClient
//
//  Created by AI Assistant on 2025/10/31.
//

import Foundation

enum MessageType {
    case text
    case image
    case emoji
    case system
}

struct ChatMessage: Identifiable, Codable {
    let id = UUID()
    let content: String
    let type: MessageType
    let senderId: String
    let senderName: String
    let timestamp: Date
    var isFromCurrentUser: Bool {
        return senderId == User.currentUser.userName
    }
    
    init(content: String, type: MessageType = .text, senderId: String, senderName: String, timestamp: Date = Date()) {
        self.content = content
        self.type = type
        self.senderId = senderId
        self.senderName = senderName
        self.timestamp = timestamp
    }
}

extension MessageType: Codable {}
